package com.qf.vue1.web.controller;

import com.qf.vue1.pojo.R;
import com.qf.vue1.pojo.User;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    @GetMapping("/get")
    public R get(User user){
        System.out.println(user);

        return R.success("SUCCESS~~");
    }

    @PostMapping("/post1")
    public R post1(User user){
        System.out.println(user);

        return R.success("SUCCESS~~");
    }

    @PostMapping("/post2")
    public R post2(@RequestBody User user,@RequestParam("pwd") String pwd){
        System.out.println(user);
        System.out.println(pwd);
        return R.success("SUCCESS~~");
    }

    @PostMapping("/axios1")
    public R axios1(User user){
        System.out.println(user);

        return R.success("SUCCESS~~");
    }

    @PostMapping("/axios2")
    public R axios2(@RequestBody User user){
        System.out.println(user);
        return R.success("SUCCESS~~");
    }

    @PostMapping("/axios3")
    public R axios3(@RequestBody User bodyUser,User paramsUser,@RequestHeader("h1") String h1,@RequestHeader("h2")String h2){
        System.out.println("bodyUser:" + bodyUser);
        System.out.println("paramsUser:" + paramsUser);
        System.out.println("h1:" + h1);
        System.out.println("h2:" + h2);
        return R.success("SUCCESS~~");
    }
}
